Tutorials for compatibility with SSJ Goku Z2

In this section, you will find various tutorials and explanations to add special features to some characters, in order to make your SSJ Goku Z2 experience even more enjoyable. Some tutorials require some spriting, others require coding knowledge, or even both, so it's up to you to put some effort understanding them.

The tutorials covered in this section are (rated with a difficulty from 1 to 5, 1 being very easy to 5 requiring very good coding knowledge):
- Introduction with Megaman by DG
- Flip Knockout
- Broken Back
- Chou Kamehameha Fatality
- Dash Collision
- Super Projectile Collision
- Beam Collision


Introduction with Megaman by DG

This is pretty straight-forward. When fighting Megaman by DG, Goku will always use the same intro to mimic him, with perfect synchronisation. However, at this point, Megaman will not necessarily use the correct intro. To fix this, all you need to do is open the file megaman.cns in Megaman's folder (its size is about 610kb), and search for the following code :

; Introduction state decider
[Statedef 190]
type = S

[State 190, 1]
type = VarRandom
trigger1 = 1
v = 3
range = 1

[State 190, 2]
type = ChangeState
trigger1 = Time = 0
value = 191 + ifelse(var(3) = 1, 0 ,3)

Once you've found it, just replace the code by the following code (new lines in red), and you're done:

; Introduction state decider
[Statedef 190]
type = S

[State 190, 1]
type = VarRandom
trigger1 = 1
v = 3
range = 1

[State 190, 2]
type = ChangeState
trigger1 = Time = 0
trigger1 = enemy,name = "SSJ Goku Z2" && enemy,authorname = "Balthazar & Cybaster"
value = 191


[State 190, 2]
type = ChangeState
trigger1 = Time = 0
value = 191 + ifelse(var(3) = 1, 0 ,3)


Flip Knockout

This animation is used when Goku hits his opponent with EX Snap Kick. The opponent flies through the screen while flipping. This animation is not a standard in fighting games, and Mugen creators usually put the opponent in a custom state and use AngleAdd to make the opponent spin/rotate.
To make your character compatible with SSJ Goku Z2, you have to add at least 3 sprites of your character spinning around the Z axis, with alignment based on the feet, as shown in the following capture:


Once the sprites are in the SFF, create Animation 5937 in the AIR file, which is the standard used for SSJ Goku Z2, and you're done. Just adding this animation will ensure that your character will use it when Goku hits him with EX Snap Kick.
Note that for Goku, states 5100, 5101 and 5110 were overriden to make Goku bounce flip after hitting the ground, just to improve the visuals. You may want to look at Goku's code in override.cns if you wish to do the same, but it isn't required.

On the other hand, you may also want Goku or any of your characters with Anim 5937 to use the Flip Knockout animation whenever possible. When sending the opponent in a custom state to make him rotate with AngleAdd, you may just want to check if the opponent has the Flip Knockout animation with SelfAnimExist(5937), and use it instead.


Broken Back

This animation is used when Goku grabs his opponent at the end of the Broken Back Kaiyoken follow-up. When falling on the Goku's hand, the opponent gets his back broken in an ackward position, accurate to the way Goku finished Nappa in Dragon Ball series.
To make your character compatible with SSJ Goku Z2, you have to add just one sprite of your character with the back broken, with alignment based on the middle of the belt, as shown on the following picture:


Goku has two sprites instead of one, just to have show some jiggling, but this is not required. Once you have added the sprite(s) to the SFF, create Animation 5946 in the AIR file, which is the standard used for SSJ Goku Z2, and you're done. Just adding this animation will ensure that your character will use it when Goku hits him with Broken Back follow-up.
Optionally, you can separate the background arm and leg of your character, and place it as Animation 5947 in the AIR file, so that it appears behind Goku, for a more realistic display. Axis should be aligned with Animation 5946, as shown on the previous picture. Note that this background sprite is not required, it is just here to make things look better. However, if you decide to add it, please add this piece of code to your helpers states :

; Broken Back - BG Arms + legs

[Statedef 245947]
type = S
movetype = H
physics = N
velset = 0,0

[State 2260, anim]
type = ChangeAnim
trigger1 = !time
value = 5947

[State 2260, bind]
type = bindtoroot
trigger1 = 1
pos = 0,0

[State 2260, muteki]
type = NotHitBy
trigger1 = 1
value = SCA

[State 2260, destroy]
type = DestroySelf
trigger1 = time = 120




Chou Kamehameha Fatality

This animation is used when Goku kills his opponent with Chou Kamehameha. The opponent is freezed in a GetHit sprite, fades to black, and finally vanishes, reduced to ashes.
To make your character compatible with SSJ Goku Z2, you need to select a GetHit sprite that will be used to create the fade animation. Turn this sprite to black, and simplify it more and more to make the character fade out through the animation. Once this is done, place the sprites in the SFF at the same axis as the base sprite, as shown on the following capture:


Once the sprites are in the SFF, create two animations : Animation 5941 and Animation 5942. Animation 5942 is optional but will make the custom state look better.
- Animation 5941 consists in the base colored sprite displayed for 30 ticks, then the black fading sprites (11 sprites in the case of SSJ Goku Z2), and finally an invisible sprite displayed indefinitely.
- Animation 5942 consists in the base color sprite displayed 15 times, each frame for 2 ticks, using the ASD method within the AIR file to make it fade to black. Basically, this animation will be displayed as an explod over animation 5941, because PalFX won't trigger correctly during the pause occuring when the character dies.
It is best to go check Goku's AIR file directly to set up these 2 animations efficiently, especially regarding the ASD method. Just adding these animations will ensure that your character will use it when Goku kills him with Chou Kamehameha.

On the other hand, you may also want your characters with beams to be able to put Goku in this Fatality state. To do this, add this code just after the HitDef of the beam attack state:

[State 3025, p2state - killed]
type = targetstate
trigger1 = movehit && numtarget
trigger1 = target, AnimExist(5941)
trigger1 = MatchOver && WinKO
value = 5941
ignorehitpause = 1

Then, search in Goku's files for states 5941 and 5942 (in states/system.cns), and copy them in your character's files wherever you want. You will probably want to modify the code a little bit to blend with your beam better.


Dash Collision

This state is triggered when two compatible characters run into each other. They will then grab each other and struggle until one of them wins. To make your character compatible with Goku (and some other characters), you will need to modify/code several things:
1- A Run (or at least a Dash) state as state 100.
2- A struggling animation, which consists in a single sprite for Goku.
3- The code for Dash Collision, with the struggling state. You need to have Var(30) free for this move.
4- A few effects. You can use those from Goku and include them in your character, or come up with yours.

1- Concerning the run state, you will need to add a ChangeState in it to go to the Dash Collision state if you're fighting compatible characters. Basically, just override the Run code and add this piece of code in it:

; DASH COLLISION ACTIVATION
[State -2, Dash Coll]
type = Changestate
triggerall = enemy,stateno=100 || enemy,stateno=950
triggerall = p2bodydist X = [-30,30]
trigger1 = enemy,selfanimexist(128950) value = 950


Finally, add a blank animation (128950) to your AIR file :

;Dash Collision check
[Begin Action 128950]
-1,0, 0,0, -1



2- Concerning the struggling sprites, you can do what you wish, just make the sure the hands stay at the same place and are located at a height of about 52 to 68 pixels. Please check Goku's struggling sprite (950,0 in the SFF) for reference. Then, place the sprite in the SFF (as shown in the following image) and create Animation 950:



3- Now you need to add the code releative to the Dash Collision state itself. Search for it in Goku's files : state 950 in states/system.cns.
Basically, the code displays various FX during the whole struggling (smoke, collision FX, white foreground, scaling, notification). Then, a set of PosAdd and width ensures both fighters get placed correctly. Several sounds and envshake occur. Then, the core of the code is there, in a nutshell: var(30) (which HAS to be free for your character) is set to 0, goes up as players smash buttons. After 80 ticks have passed, the character goes to a state depending on if his var(30) is higher than the opponent's or not:
- If he wins, he goes to state 951. You will have to create this one yourself to define what your character does when he wins. You don't have to use state 951 if you don't want to.
- If he loses, he goes to stance state with no control, waiting for the opponent to hit or throw him.
- If there's a draw, he goes in backdash state.

4- Finally, it is also important you add the effects sprites in your character, since only teamside=1 will trigger them. The animation used in Goku are animations 955, 956, 957 and 958. There's also a notification helper in state 13200 (search in states/helpers.cns if you want to use it). Feel free to use all the FX from Goku for Dash Collision, or come up with yours if they don't blend well.


Beam Collision


This state is triggered when one character is charging his beam, and the other character counters and starts charging his beam too, granted he has enough power and has control. Both characters will then release their beam at the same time, and players will have to smash buttons in order to decide the winner.
This interaction involves a lot of coding and testing to ensure everything works correctly and all states are synchronised. The code cannot be put into a sort of template for everybody to use, and each stuff will have to be coded on a 1-on-1 basis. In this chapter, I will give you various pointers and explanations about how Goku's code works, and what you will need to add or modify.
P1 will refer to the first character charging his beam, while P2 will refer to the character who inputs the Counter command and activates the Beam Collision.

1 - Activating Beam Collision - P1 part :
- You will have to modify the superpause part of the super, because the opponent won't be able to input the counter motion if he is in a superpause, as commands are not read during superpauses. For this, you just need to set up a variable in the charging state of the move, depending on who's the opponent and if he has control and such:

[state 1315]
type = varset
trigger1 = !time
var(11) = 0
[state 1315]
type = varset
triggerall = numenemy
triggerall = (enemy,statetype != A)
triggerall = TeamMode = Single
triggerall = (enemy, ctrl) || (enemy, stateno=100) || (enemy, stateno=101)
triggerall = enemy,power >= 2000
trigger1 = enemy,name = "SSJ Goku Z2"
trigger1 = enemy,authorname = "Balthazar & Cybaster"
var(11) = 1

Then, you just need to activate the superpause as usual, but adding var(11) or whatever variable you've used as trigger. Hence, if the opponent is compatible and can possibly do a Beam Counter, the SuperPause won't be triggered.
Please note that the opponent's name (and optionally author name) are required, so please send me a PM or a mail if you want me to add the triggers to SSJ Goku Z2.

2 - Activating Beam Collision - P2 part :
As you have seen, if P2 can possibly Beam Counter his opponent, the superpause is not activated. But obviously, you don't want P2 to be able to move and do what he wants during the usual superpause. To take care of this, you will have to add some code in state -2. You will basically need:
- A CtrlSet set to 0, triggered by the opponent's charge state, to ensure P2 has no control during the time corresponding to the default superpause.
- A CtrlSet set to 1, to give back control to P2 when the opponent finished the superpause part of his charge.
- A PosFreeze with the same triggers, to ensure P2 can't change position and is freezed during the superpause.
- A ChangeAnim with "value=anim" and "elem=animelemno(0)"to set P2's sprite to a static one.
- A VarSet and ChangeState triggered by power, command and the opponent's state :

[State -2]
type = VarSet
triggerall = numenemy
triggerall = var(31) = 0
triggerall = command = "f2p"
triggerall = power >= 2000
triggerall = P2Dist X > 80
triggerall = anim = 0 || anim = 5 || anim = 6 || anim = 10 || anim = 11 || anim = 12 || anim = 20 || anim = 21 || anim = 100 || anim = 101
trigger1 = enemy,name = "SSJ Goku Z2" && enemy,authorname = "Balthazar & Cybaster"
trigger1 = (enemy,stateno=2400) && (enemy,anim=2400) && (enemy,animelemtime(4)>=0) && (enemy,var(26)=0)
var(31) = 1

[state 1315]
type = ChangeState
trigger1 = var(31)=1 && stateno!=2480
value = 2480

As you can see, when the command is performed within the correct conditions, P2 is sent to state 2480. Of course, you don't need to use the same state numbers, but using them will enable easier compatibility check with other characters.

3 - Beam Counter Charge and launch :
- P2 part : State 2480 (in Goku at least) is a simple copy of the normal beam charging state. Only thing differentiating it visually is the presence of a large super portrait scrolling behind him. Feel free to do whatever you want to make the super charge countering look good. When you reach the end of the animation, just put a changestate to the beam collision state, which HAS to be state 2481.
- P1 part : Your character should have a ChangeState going to the beam launching state for normal conditions. Here, because of Beam Counter, you will have to add a few triggers to your ChangeState to block P1 into his charging state until P2 has finished charging, and you will need to add a ChargeState to state 2481 (the Beam Collision state) :

;Throw Kmh when Beam Counter
[State 901, ChangeAnim]
type = ChangeState
triggerall = Anim=2400
trigger1 = enemy,name = "SSJ Goku Z2" && enemy,stateno=2481
value = 2481
ctrl = 0

;Throw Kmh
[State 901, ChangeAnim]
type = ChangeState
triggerall = blabla
triggerall = (enemy,name != "SSJ Goku Z2") || (enemy,name = "SSJ Goku Z2" && enemy,stateno!=[2480,2481])
trigger1 = (command != "hold_x") && (command != "hold_y") && (command != "hold_z")
trigger2 = time >= 350
value = 2401
ctrl = 0

If you want your character to be compatible with Goku, you will thus need to add the Goku related trigger codes, but also send me your character's triggers and states for the ChangeStates.

4 - Beam Collision :
Both characters should share the exact same code to ensure good compatibility and no "cheating". Basically, just copy-paste state 2481 from supers.cns to your character, and modify the explods so they blend with yours. Here's an explanation about the code :
- Note that statedef doesn't specify any animation at first.
- You can use Goku's Beam Collision notification helper if you wish, only teamside=1 will display it.
- Various assertspecials to ensure there are no lifebars, background, foreground, and that the timer is freezed.
- You change the animation ONLY when the opponent reaches the state too. This is just to fix a 1 tick offset.
- Removing various explods from previous states. Modify according to your character.
- Make the screen shake with envshake, scale the character to the correct value (by half) and position it on the screen.
- Set the variable from state -2 back to zero.
- Display various voices and explods for epic atmosphere!
- Note that the beam is displayed with a scaling explod, which scale factor depends on the value of the smashing variable (here fvar(20)).
- The center collision FX is coded as a helper, created by the player facing right, and will be displayed accordingly to the smashing variable.
- The core of the code for struggling is then handled by var(30), which needs to be free for your character. This variable is then scaled to [0,1] by reading the opponent's var(30) value, and is stored in fvar(20) in SSJ Goku Z2, but you can use another floating variable if you want. fvar(20)=0 means you're completely losing the fight, fvar(20)=0.5 means your var(30)=enemy,var(30) and fvar(20)=1 means you're beating the opponent by 20 smashes.
- Finally, a changestate occurs depending on fvar(20) and time. If you beat the opponent by 20 smashes or more, you go to state 2485. Otherwise, if 5 seconds have passed and there's no winner, both characters will be sent to state 2489.

5 - Beam Collision ending :
Please look at the coding in supers.cns to see what was done exactly for Goku. Basically, here the various states and what they're for :
- 2485 : Goku wins the Beam Collision. He stays in the same animation, has his beam growing much bigger, displays hitsounds and hitsparks, and with a hitdef, sends the opponent in a custom state depending on his life.
- 2486 : custom state in which Goku is sent when he loses Beam Collision, without being killed. He loses 350 life, has a hit scream and triggers a white Super BG.
- 2487 : custom state in which Goku is sent when he loses Beam Collision, but being killed by it. This is basically a copy of the Chou Kamehameha Fatality state, but scaled down.
- 2488 : temporary state for the winner just to remove all explods and do last moment stuff.
- 2489 : state for when there's no winner for Beam Collision. The character keeps the same animation, but the center collision ball grows bigger (done through helper), and the white super BG appears. Characters then go to state 2490.
- 2490 : remove various helpers and remove life depending on how much your var(30) is compared to the opponent's one. Then, send the character to state 5110 with a SelfState to finish things off.